<?php $member = Member::model()->findByPk($event->member_id);?>
<div class="div div-plain row">
	<div style='padding: 10px;'>
		<h2>
			<?php echo CHtml::link($event->title, array("event/view","id"=>$event->id,'username'=>$member->username))?>
		</h2>
	</div>

	<div class='span2'>
		<?php 
		if(file_exists(Utils::getImagePathById("cover", "thumbnail", $event->id))){
			$image = CHtml::image(Utils::getImageUrlById("cover", "thumbnail", $event->id),$event->title,array('class'=>"thumbnail"));
		}else{
			$image = CHtml::image(Utils::getImageUrlById("avatar", "", $member->id),$event->title,array('class'=>"thumbnail"));
		}

		echo CHtml::link($image, array("event/view","id"=>$event->id,'username'=>$member->username))
		?>
	</div>
	<div class='span6'>
		<table class='table'>
			<tr>
				<td>简介</td>
				<td><?php echo mb_substr(trim(strip_tags($event->content)),0,80,'utf8');?>...</td>
			</tr>
			<tr>
				<td style='width: 40px;'>时间</td>
				<td><?php echo date("Y年m月d日 G点i分",strtotime($event->start))." 到 ".date("G点i分",strtotime($event->end)) ?>
				</td>
			</tr>
			<tr>
				<td>地点</td>
				<td><?php echo $event->location?></td>
			</tr>
			<tr>
				<td>人数</td>
				<td><?php 
				$count = UserEventRelation::model()->count("event_id = $event->id");
				echo "{$count}/{$event->limit} (报名/总数)";
				?></td>
			</tr>

			<?php if(!empty($isDisplayButtons)):?>
			<tr>
				<td>分享</td>
				<td>
					<!-- JiaThis Button BEGIN -->
					<div id="jiathis_style_32x32">
						<a class="jiathis_button_qzone"></a> <a
							class="jiathis_button_tsina"></a> <a class="jiathis_button_tqq"></a>
						<a class="jiathis_button_renren"></a> <a
							class="jiathis_button_kaixin001"></a> <a
							href="http://www.jiathis.com/share?uid=2894"
							class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
						<a class="jiathis_counter_style"></a>
					</div> <script type="text/javascript">var jiathis_config = {data_track_clickback:true};</script>

					<!-- JiaThis Button END -->
				</td>
			</tr>
			<tr>
				<td></td>
				<td>
					<div class='btn-group'>
						<?php 
						$relation = UserEventRelation::model()->find("event_id = :event_id and member_id=:member_id",array("event_id"=>$event->id,"member_id"=>Yii::app()->user->id));
						if(empty($relation)){
							echo CHtml::link('<i class="icon-plus icon-black"></i> 参加', array("event/join","id"=>$event->id,'username'=>$member->username),array("class"=>'btn'));
						}else{
							echo CHtml::link('<i class="icon-minus icon-black"></i> 退出', array("event/withdraw","id"=>$event->id,'username'=>$member->username),array("class"=>'btn'));
						}
						if(!Yii::app()->user->isGuest){
							Utils::displayBtn(CHtml::link('<i class="icon-edit icon-black"></i> 编辑', array("event/add","id"=>$event->id,'username'=>$member->username),array("class"=>'btn')));
							Utils::displayBtn(CHtml::link('<i class="icon-camera icon-black"></i> 相册',array("album/upload","album_id"=>$event->album_id,"album_title"=>$event->title,'username'=>$_GET['username']),array("class"=>'btn')));
						}
						if(Utils::isAdmin()){
							echo CHtml::link('<i class="icon-remove-sign icon-black"></i> 删除', array("event/delete","id"=>$event->id,'username'=>$member->username),array("class"=>'btn','onclick'=>'return confirm("确定要删除吗？")'));
						}
						?>
					</div>
				</td>
			</tr>
			<?php endif;?>
		</table>
	</div>
</div>


<script type="text/javascript"
	src="http://v2.jiathis.com/code/jia.js?uid=2894" charset="utf-8"></script>
